<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">

    <!--[if lt IE 9]>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/html5.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/respond.min.js"></script>
    <![endif]-->

    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
</head>
<body>
<div class="container">
    <form class="form-horizontal m-t" method="post" action="${pageContext.request.contextPath}/admin/tshelves_edit.action"
          enctype="multipart/form-data" id="form">
        <input type="hidden" value="${tshelves.sid}" name="sid">
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label"><i class="require">*</i>资源名称:</label>
            <div class="col-sm-8">
                <input class="form-control" name="name" size="30" value="${tshelves.name}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label"><i class="require">*</i>资源类型:</label>
            <div class="col-sm-8">
                <div class="col-sm-3 m-t2">
                    <input type="radio" checked name="type" size="30" value="I"/><label>图片</label>
                </div>
                <div class="col-sm-3 m-t2">
                    <input type="radio" name="type" size="30" value="M"/><label>多媒体</label>
                </div>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label"><i class="require">*</i>资源是否共享:</label>
            <div class="col-sm-8">
                <div class="col-sm-3 m-t2">
                    <input type="radio" name="ifShare" size="30" value="1"/><label>共享</label>
                </div>
                <div class="col-sm-3 m-t2">
                    <input type="radio" name="ifShare" size="30" value="0"/><label>不共享</label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label"><i class="require">*</i>上传资源:</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <input class="form-control" name="content" id="content" readonly size="30"/>
                    <div class="input-group-addon upload">
                        <input class="form-control" id="upload" type="file" name="upload"
                               style="position: absolute;width: 60px;opacity: 0;"/>
                        <a class="btn btn-primary">上传</a>
                    </div>
                </div>
        <div style="margin-top: 6px;margin-bottom: 0px;font-family: 微软雅黑;font-size: 12px;color:#999999;">
        	*上传图片要求：尺寸为555*555，JPEG(*.JPG、*.JPEG、*.JPE)格式或是PNG格式
		</div>                          
                    <%-- <input class="form-control" name="content" size="30"/>--%>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label"><i class="require">*</i>URL:</label>
            <div class="col-sm-8">
                <input class="form-control" name="cUrl" size="30" id="cUrl" value="${tshelves.cUrl}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">结算方式:</label>
            <div class="col-sm-8">
                <input class="form-control" name="settlementMethod" value="${tshelves.settlementMethod}" size="30"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">预计收益:</label>
            <div class="col-sm-8">
                <input class="form-control" name="expectedIncome" value="${tshelves.expectedIncome}" size="30"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">广告详情:</label>
            <div class="col-sm-8">
                <input class="form-control" name="adDetails" value="${tshelves.adDetails}" size="30"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">自动隐藏弹框:</label>
            <div class="col-sm-8">
                <div class="col-sm-2 m-t2">
                    <input type="radio" name="visiAble" size="30" value="1"/><label>是</label>
                </div>
                <div class="col-sm-2 m-t2">
                    <input type="radio" name="visiAble" size="30" value="0"/><label>否</label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">上架人:</label>
            <div class="col-sm-8">
            	<input class="form-control" name="operator" size="30" value="${tshelves.uname}" disabled="disabled"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">上架时间:</label>
            <div class="col-sm-8">
            	<input class="form-control" name="cTime" size="30" id="cTime" value="${tshelves.cTime}" disabled="disabled"/>
            </div>
        </div>
       <script type="text/javascript">
           $(function () {

               $("input[name='visiAble'][value='${tshelves.visiAble}']").attr("checked", true);
               $("input[name='type'][value='${tshelves.type}']").attr("checked", true);
               $("input[name='ifShare'][value='${tshelves.ifShare}']").attr("checked", true);
               $("#content").val('${tshelves.content}'.substring('${tshelves.content}'.lastIndexOf('/')+1));
               $("#upload").change(function () {
                   var filename = $(this).val();
                   var index = filename.lastIndexOf("\\");
                   $("input[name='content']").val(filename.substring(index + 1));
               });
           });

           function upload() {
               document.getElementById("upload").click();
           }
       </script>
    </form>
</div>
</body>
</html>
